﻿// /////////////////////////////////// 
//  
//  
//      WiseLink CCF2.0 
//     (c)Copyright 2001-2010 WiseLink Xiaojun (David) Chen 
//        Authored and Owned Xiaojun (David) Chen 
//        All Right Reserved
//  
// /////////////////////////////////// 

using System;
using System.Text;
using CCF20Model.Common.Infrastructure;
using System.Windows.Input;
using CCF20Model;
using System.Web.Profile;
using System.Web.Security;
using System.Windows;
using System.Diagnostics;
using System.IO;
using CCF20Model.ConfigurationFile;
using CCF20.Resources;
using WiseLink.RDS.Resource;

namespace CCF20Module
{
    class ChinaMobileLoginWindowViewModel : LoginWindowViewModel
    {
        public ChinaMobileLoginWindowViewModel() : base()
        {
            loginModel.LoginStatus = string.Empty;
            loginModel.ShowIDSLoginPanel = Visibility.Visible;
        }
        #region Commands

        public ICommand IDSLoginCommand
        {
            get { return new RelayCommand(IDSLoginExecute); }
        }

        
        #endregion //Commands

        
        void IDSLoginExecute()
        {
            if (ZICBase.RunMethod(ZICMethod.CheckLogin, new object[]{loginModel.IDSName, loginModel.IDSPassword}))
            {
                ProfileModel.SaveIDSUserPasswrod(loginModel.IDSName, loginModel.IDSPassword);
                loginModel.LoginStatus = StringLogin.lblIDSLoginSuccess;
            }
            else
            {
                loginModel.LoginStatus = StringLogin.lblIDSLoginFailed;
            }

        }
        
    }
}
